<!DOCTYPE html>
<html>

	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title>后台 - 权限设置</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="favicon.ico">
		<link href="__PUBLIC__/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/animate.min.css" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">

	</head>

	<body class="gray-bg">
		<div class="wrapper wrapper-content animated fadeInRight">
			<div class="row">
				<div class="col-sm-12">
					<div class="ibox float-e-margins">
						<div class="ibox-title">						
							<div class="ibox-tools">
								<a class="collapse-link">
									<i class="fa fa-chevron-up"></i>
								</a>
							</div>
						</div>
						<div class="ibox-content">
							<form class="form-horizontal" method="post" action="{:U('Admin/Admin/access')}" name="signupForm" id="signupForm" enctype="multipart/form-data">
								<div class="tree"  id="level">
									<ul>
										<volist name="navlist" id="vo" key="num">
											<if condition="$vo['pid'] eq 0">
												<li>
													<input type="checkbox" name="rule[]" value="{$vo.id}" <php>if(strpos($group,'#'.$vo['id'].'#')>-1){echo "checked";} </php>>{$vo.nav_name}
													<ul>
														<volist name="navlist" id="menu">
															<if condition="$menu['pid'] eq $vo['id']">
																<li>
																	<input type="checkbox" name="rule[]" value="{$menu.id}" <php>if(strpos($group,'#'.$menu['id'].'#')>-1){echo "checked";} </php>>{$menu.nav_name}
																	<ul>
																		<volist name="navlist" id="sons">
																			<if condition="$sons['pid'] eq $menu['id']">
																				<li>
																					<input type="checkbox" name="rule[]" value="{$sons.id}" <php>if(strpos($group,'#'.$sons['id'].'#')>-1){echo "checked";} </php>>{$sons.nav_name}
																				</li>
																			</if>
																		</volist>
																	</ul>
																</li>
															</if>
														</volist>
													</ul>
												</li>
											</if>
										</volist>
									</ul>
								</div>
								<div class="form-group">
									<div style="margin-left: 4%;" class="col-sm-2 col-sm-offset-0">
										<input type="checkbox" id="checkall" >全选
										<input type="checkbox" id="uncheck" >不选
										<input type="checkbox" id="othercheck" >反选
									</div>
									<div class="col-sm-4 col-sm-offset-0">
										<input type="hidden" name="id" value="{$role_id}">
										<button class="btn btn-primary" type="submit">保存内容</button>
										<a class="btn btn-danger" href="{:U('Admin/Admin/rolelist')}">取消</a>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
		
		<script src="__PUBLIC__/Admin/js/jquery.min.js?v=2.1.4"></script>
		<script src="__PUBLIC__/Admin/js/bootstrap.min.js?v=3.3.6"></script>
		<script src="__PUBLIC__/Admin/js/content.min.js?v=1.0.0"></script>
		<script src="__PUBLIC__/Common/js/ajaxForm.js"></script>
		<script src="__PUBLIC__/Common/layer/layer.js"></script>
		<script>
			$(function(){
				$('#signupForm').ajaxForm({
					success: complete, 
					dataType: 'json'
				});
				function complete(data){
					if(data.status==1){
						$('.btn-primary').attr('disabled','disabled');
						layer.msg(data.info, function(index){
			 				layer.close(index);
							window.location.href=data.url;
						});
					}else{
						layer.msg(data.info);
						return false;	
					}
				}
			});
		</script>
		<script>
			window.onload=function(){
				//全选、不选、反选
				var CheckAll=document.getElementById('checkall');
				var UnCheck=document.getElementById('uncheck');
				var OtherCheck=document.getElementById('othercheck');
				var div=document.getElementById('level');
				var CheckBox=div.getElementsByTagName('input');
				CheckAll.onclick=function(){
					UnCheck.checked=false;
					OtherCheck.checked=false;
					for(i=0;i<CheckBox.length;i++){
						CheckBox[i].checked=true;
					};
				};
				UnCheck.onclick=function(){
					CheckAll.checked=false;
					OtherCheck.checked=false;
					for(i=0;i<CheckBox.length;i++){
						CheckBox[i].checked=false;
					};
				};
				OtherCheck.onclick=function(){
					UnCheck.checked=false;
					CheckAll.checked=false;
					for(i=0;i<CheckBox.length;i++){
						if(CheckBox[i].checked==true){
							CheckBox[i].checked=false;
						}else{
							CheckBox[i].checked=true
						}
					};
				};
			};
		</script>
	</body>

</html>